import service from '@/utils/request'
import { CancelToken } from 'axios'
// 导入指令
export function importCommand(params) {
  return service.get('/gps/command/importCmd', {
    params
  })
}

// 导出命令报表
export function exportCommandLogs(params) {
  return service.post(
    '/gps/command/export/commandLogs',
    {
      params
    }
    //   responseType: 'blob',
  )
}

// 获取指令下发记录
export function getCmdLogs(params) {
  return service.get('/gps/command/records', {
    params
  })
}

// 发送命令
export function sendCommand(data) {
  return service.post('/gps/command/sendCmd', data)
}
export function sendCommandMini(data, config: { cancelToken: CancelToken } | {}) {
  config.timeout = 25000
  return service.post('/gps/command/sendCmdMini', data, config)
}
export function jt1078Heart(key: string) {
  return service.post('/gps/command/jt1078Heart', key, {
    headers: {
      'Content-type': 'text/plain'
    }
  })
}
// 取消发送指令
export function cancelCommand(params) {
  return service.delete('/gps/command/delCacheCmd', {
    params
  })
}
